.switch {
  position: relative;
  display: inline-block;
  width: calc(4 * var(--base-spacing));
  height: calc(calc(2 * var(--base-spacing)) + 2px);
  margin: var(--base-spacing);
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--switch-background-default);
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: calc(calc(4 * var(--base-spacing)) + 2px);
}

.slider:before {
  position: absolute;
  content: "";
  height: calc(2 * var(--base-spacing));
  width: calc(2 * var(--base-spacing));
  left: 1px;
  bottom: 1px;
  background-color: var(--switch-button);
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--switch-background-selected);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--switch-background-selected);
}

input:checked + .slider:before {
  -webkit-transform: translateX(calc(calc(2 * var(--base-spacing)) - 2px));
  -ms-transform: translateX(calc(calc(2 * var(--base-spacing)) - 2px));
  transform: translateX(calc(calc(2 * var(--base-spacing)) - 2px));
}
